<template>
  <view class="component-modal">
    <view class="mask"></view>
    <view class="container">
      <view class="container-nav">
        <text class="title">{{title}}</text>
        <view class="content">
          <slot></slot>
        </view>
        <view class="footer">
          <button @click="handleConfirm">确定</button>
        </view>
      </view>
    </view>
  </view>
</template>
<script>
export default {
  props: {
    title: {
      type: String,
      default: ''
    }
  },
  data() {
    return {}
  },
  methods: {
    handleConfirm() {
      this.$emit('confirm')
    }
  }
}
</script>
<style lang="scss" scoped>
  .component-modal {
    .mask {
      width: 100vw;
      height: 100vh;
      position: fixed;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      background: #ccc;
      filter: Alpha(Opacity=60);
      opacity: 0.6;
      z-index: 999;
    }
    .container {
      width: 100vw;
      height: 100vh;
      position: fixed;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      z-index: 1000;
      .container-nav {
        width: 80%;
        height: auto;
        max-height: 80vh;
        margin-top: 10vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        background: #fff;
        border-radius: 10rpx;
        .title {
          font-size: 36rpx;
          font-weight: 600;
          color: #222;
          flex-shrink: 0;
        }
        .content {
          padding: 10rpx;
          flex: 1;
          overflow-y: auto;
        }
        .footer {
          flex-shrink: 0;
          width: 100%;
          button {
            border: none;
          }
        }
      }
    }
  }
</style>
